
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
import service.Customer;
import service.ICustomerServiceWrapper;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author hahnepeter
 */
public class Client {


    public static void main(String[] args) {
        System.out.println("testing MailService");
        System.out.println("-----------------------------------");
        JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
        //factory.getInInterceptors().add(new LoggingInInterceptor());
        //factory.getOutInterceptors().add(new LoggingOutInterceptor());
        factory.setServiceClass(service.ICustomerServiceWrapper.class);
        factory.setAddress("http://localhost:8012/customers");
        ICustomerServiceWrapper serviceWrapper = (ICustomerServiceWrapper)factory.create();
        Customer customer = null;
        try {
            customer = serviceWrapper.getCustomer("1");
        } catch (Exception ex) {
            Logger.getLogger(Client.class.getName()).log(Level.SEVERE, null, ex);
        }
        System.out.println("hallo "+customer.getName());
        try {
            customer = serviceWrapper.getCustomer("2");
        } catch (Exception ex) {
            Logger.getLogger(Client.class.getName()).log(Level.SEVERE, null, ex);
        }
        System.out.println("hallo "+customer.getName());
        try {
            customer = serviceWrapper.getCustomer("3");
        } catch (Exception ex) {
            Logger.getLogger(Client.class.getName()).log(Level.SEVERE, null, ex);
        }
        System.out.println("hallo "+customer.getName());
    }
}
